<?php
	include('../../../public/bootrap.php');
	$id = _POST('id');
	
	$color = _POST('color');
	$file 		= $_FILES['uploadimage'.$id];
	
	$fileName	= uploadfile("../../../media/product/images/color/",$file,1);
	
	$data	= array('img_url'=>'/media/product/images/color/'.$fileName,
					'color_code'=>$color
	);
					
	$imageid = $db->insert('tblproduct_color', $data);				
	
	$data	= array( "file"=>$fileName
				,"title"=>$file['name']
				,'colorid'=>$imageid
				,'img'=>true
			);
	print json_encode($data);
	exit();